package test.test6_19;

import java.util.Scanner;

public class PrimeNum {
    public static void main(String[] args) {
        Scanner scanner = new Scanner (System.in);
        if(scanner.hasNextInt()) {
            int n = scanner.nextInt();
            int count = 0;//记录素数的个数
            for (int i = 2; i <= n; i++) {
                boolean isPrimeNum = true; // 用于标记是否是素数
                for (int j = 2; j < i; j++) {
                    if (i % j == 0 ) {
                        isPrimeNum = false;
                        break;
                    }
                }
                if (isPrimeNum == true) {
                    System.out.print(i+"\t");
                    count++;
                }
            }
            System.out.println("总共有：" + count+"个素数");
        }
        scanner.close(); // 关闭 IO 流
    }
}
